package com.lijie.ljblog.controller;


import com.github.pagehelper.PageInfo;
import com.lijie.ljblog.model.Classify;
import com.lijie.ljblog.service.ClassifyService;
import com.lijie.ljblog.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lijie
 * @since 2021-08-28
 */
@RestController
@RequestMapping("/ljblog/classify")
public class ClassifyController {
    @Autowired
    ClassifyService classifyService;
    @RequestMapping("getGroupName")
    public List<Classify> getGroupName(){
        return  classifyService.getPClassify();
    }

    @RequestMapping("getClassifyByPid")
    public PageInfo<Classify> getClassifyByPid(@RequestBody Classify classify){
        return classifyService.getClassifyByPid(Integer.parseInt(classify.getParentId()));
    }

    @RequestMapping("addClassify")
    public Result<Object> addClassify(@RequestBody Classify classify){
        return classifyService.addClassify(classify);
    }

}

